Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better inverses #1021

Merged
merged 47 commits into from
Nov 8, 2024
Merged

Better inverses #1021

merged 47 commits into from
Nov 8, 2024

Conversation

Tianrun-Y
Copy link
Collaborator

@Tianrun-Y Tianrun-Y commented Jul 2, 2024

Add a better method for finding inverses of a multiplicative element of a semigroup that can use Froidure-Pin.
Also add a new method called OneInverseOfSemigroupElement.

@james-d-mitchell james-d-mitchell added performance A label for issues or PRs that relate to performance. enhancement A label for issues or PRs that offer an enhancement to existing functionality labels Jul 29, 2024
Tianrun-Y and others added 2 commits July 29, 2024 13:16
Co-authored-by: James Mitchell <[email protected]>
Co-authored-by: James Mitchell <[email protected]>
gap/attributes/attr.gi Outdated Show resolved Hide resolved
gap/attributes/attr.gi Outdated Show resolved Hide resolved
gap/attributes/attr.gi Outdated Show resolved Hide resolved
if path = fail then
# This can occur when, for example, a = b and S is not a monoid.
return One(gens);
if IsMultiplicativeElement(a) and IsMultiplicativeElement(b) then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this does exactly what you want it to, maybe you meant not IsMultiplicativeElementWithOne(a) and similar for b?

This comment was marked as resolved.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still missing, and the documentation for Left/RightGreensMultiplier should be updated to include:

If S is a semigroup but not a monoid, then the return value is either of the same type as the elements of S or an adjoined identity.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing "WithOne" fixed. The documentation is possibly more delicate than that, as an fp semigroup can be a monoid but GAP cannot recognise it as one. One example is < s1, s2 | s1^2=s1, s2^2=s2, s1s2=s2, s2s1=s2>. s1 is a "one" but GAP does not know that.

if IsMultiplicativeElement(a) and IsMultiplicativeElement(b) then
return One(gens);
else
return SEMIGROUPS.UniversalFakeOne;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should add some tests for this too?

Copy link
Collaborator

@james-d-mitchell james-d-mitchell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, a few specific comments, you'll need to:

  • add more test for everything
  • a non-no-check version of OneInverseOfSemigroupElementNC
  • doc for OneInverseOfSemigroupElement
  • fix IsMultiplicativeElementWithOne in the other place indicated.

Copy link
Collaborator

@james-d-mitchell james-d-mitchell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And tests for code coverage as indicated during our meeting just now using:

etc/code-coverage-test-gap.py --gap-root /Users/jdm/gap tst/standard/main/froidure-pin.tst

from inside the semigroups package directory where you are doing your development.

Tianrun-Y and others added 2 commits July 30, 2024 18:41
Copy link
Collaborator Author

@Tianrun-Y Tianrun-Y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know which chapter of the documentation this should go to.
Also, might expand the description if needed. example?

gap/attributes/attr.gi Outdated Show resolved Hide resolved
if path = fail then
# This can occur when, for example, a = b and S is not a monoid.
return One(gens);
if IsMultiplicativeElement(a) and IsMultiplicativeElement(b) then

This comment was marked as resolved.

gap/attributes/attr.gi Show resolved Hide resolved
@Tianrun-Y
Copy link
Collaborator Author

currently no test for finding inverse of a semigroup that cannot use Froidure-Pin.

<Description>
<C>OneInverseOfSemigroupElement</C> returns one inverse of the element
<C>x</C> in the semigroup <A>S</A>.
</Description>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example please!

@Tianrun-Y
Copy link
Collaborator Author

currently no test for finding inverse of a semigroup that cannot use Froidure-Pin.

found one using Semigroup(SEMIGROUPS.UniversalFakeOne). Resolved

doc/attr.xml Outdated
<Returns> One inverse of an element of a semigroup.</Returns>
<Description>
<C>OneInverseOfSemigroupElement</C> returns one inverse of the element
<C>x</C> in the semigroup <A>S</A>.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if there is no inverse?

doc/attr.xml Outdated Show resolved Hide resolved
Copy link
Collaborator

@james-d-mitchell james-d-mitchell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one, sorry for the long delay!

@james-d-mitchell james-d-mitchell enabled auto-merge (squash) November 8, 2024 10:17
@james-d-mitchell james-d-mitchell merged commit 4f732b7 into semigroups:main Nov 8, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A label for issues or PRs that offer an enhancement to existing functionality performance A label for issues or PRs that relate to performance.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants